package chapter;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.Locale;

public class TestIterator {
    public static void main(String[] args) {
        Collection<String> collection = new ArrayList<>();
        collection.add("Neww York");
        collection.add("Atlanta");
        collection.add("Dallas");
        collection.add("柳州");
        collection.add("Madison");
        Iterator<String> iterator = collection.iterator();

        iterator.forEachRemaining(x-> System.out.print(x.toUpperCase()+ " "));

        System.out.println();

        Collection<Student> collection2 = new ArrayList<>();
        collection2.add(new Student("韦国荣","2班",85));
        collection2.add(new Student("张三","3班",80));
        collection2.add(new Student("小刘","1班",60));
        for (Student v:collection2){
            if (v.clas.equals("2班")){
                v.achievement=v.achievement+10;
                if (v.achievement>=100){
                    v.achievement=100;
                }
            }
        }
        for (Student v:collection2){
            System.out.println(v);
        }
    }
}
